using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CodeStory.Core.UI;
using CodeStory.News.ObjectEntity;
using CodeStory.Core;

namespace CodeStory.WebApplication.News
{
	[NavigationPortlet("CodeStory_News_ShowNews")]
	public partial class ShowNews : Portlet
	{
		protected override void OnInit(EventArgs e) {
			Load += new EventHandler(ShowNews_Load);
			base.OnInit(e);
		}

		void ShowNews_Load(object sender, EventArgs e) {
			//throw new Exception("The method or operation is not implemented.");
			if (!IsPostBack) {
				BindNews();
			}
		}

		private void BindNews() {
			string id = Request.QueryString["newsid"];
			if (string.IsNullOrEmpty(id)) return;
			NewsContentObject n = NewsContentObject.Read(new Guid(id));
			lblTitle.Text = n.NewsTitle;
			lblContent.Text = n.NewsContent;
		}
	}
}